package common.html;

import org.apache.commons.lang.StringUtils;
import common.html.Tag.SpecialTag;

public class LinkTag extends SpecialTag
{
    String rel = "stylesheet";
    String href;
    public final static String ATTR_REL = "rel";

    public final static String ATTR_HREF = "href";

    public LinkTag()
    {
        super();
        putAttr(ATTR_REL, rel);
    }

    public LinkTag(String href)
    {
        this();
        setHref(href);
    }

    public String getTagName()
    {
        return "link";
    }

    public String getRel()
    {
        return rel;
    }

    public void setRel(String rel)
    {
        this.rel = rel;
        putAttr(ATTR_REL, rel);
    }

    public String getHref()
    {
        return href;
    }

    public void setHref(String href)
    {
        this.href = href;
        putAttr(ATTR_HREF, href);
    }

    public LinkTag css(String internalStyleSheet)
    {
        content(internalStyleSheet);
        return this;
    }

    public LinkTag apped(String internalStyleSheet)
    {
        String newContent = "";
        if (StringUtils.isNotBlank(this.content))
        {
            newContent = this.content;
        }

        newContent.concat(internalStyleSheet);
        content(newLine(newContent));
        return this;
    }
}
